package cn.edu.sjtu.se.dslab.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.sjtu.se.dslab.component.data.DataEntity;
import cn.edu.sjtu.se.dslab.component.data.Operation;
import cn.edu.sjtu.se.dslab.dao.IOperationDao;
import cn.edu.sjtu.se.dslab.service.IOperationService;

@Service("operationService")
@Transactional
public class OperationServiceImpl implements IOperationService {

	@Resource(name = "operationDao")
	private IOperationDao operationDao;
	
	@Override
	public boolean addOperation(Operation operation) {
		// TODO Auto-generated method stub
		operationDao.save(operation);
		return true;
	}

	@Override
	public boolean updateOperation(Operation operation) {
		// TODO Auto-generated method stub
		operationDao.update(operation);
		return true;
	}

	@Override
	public Operation getOperationById(long id) {
		// TODO Auto-generated method stub
		return operationDao.queryById(id);
	}

	@Override
	public List<Operation> getOperationByDataEntity(DataEntity entity) {
		// TODO Auto-generated method stub
		return operationDao.queryByDataEntity(entity);
	}

}
